package models

type Article struct {
	Id int `json:"id"`
	//TagID   int    `json:"tag_id" gorm:"index"`
	//	Tag     Tag    `json:"tag"`
	Title   string `json:"title" gorm:"title"`
	Desc    string `json:"desc"`
	Content string `json:"content"`
	State   int    `json:"state"`
}

// func GetArticles() (article Article) {
// 	where := make(map[string]interface{})
// 	where["title"] = "测试"
// 	fmt.Println(where)
// 	// db.where("title = ?", "测试").First(&article)

// 	return
// }

func GetArticles(where map[string]interface{}) (articles []Article) {
	Db.Where(where).Find(&articles)
	return
}
